import React from 'react';
import { Input } from 'gantd';

const SplitExcelInput = (props: any) => {
  const { onChange, ...restProps } = props;

  const _onChange = (value: any) => {
    let _value = value;
    if (event?.inputType == 'insertFromPaste') {
      _value = value.split(/[\n\s]+/).join(',');
    }
    onChange(_value);
  };

  return <Input onChange={_onChange} {...restProps} />;
};

export default SplitExcelInput;
